/*
 * AddFrame.java
 *
 * Created on May 26, 2005, 2:52 PM
 */

package com.bff.slimserver.musicjukebox.ui;

import com.bff.bjj.ui.component.BJJButton;
import java.awt.Dimension;
import java.awt.Toolkit;
import javax.swing.JPanel;


/**
 *
 * @author  bill
 */
public class GenericPanelFrame extends javax.swing.JFrame {
    private String title;
    private JPanel middlePanel;
    
    /** Creates new form AddFrame */
    public GenericPanelFrame(String title, JPanel middlePanel) {
        this.middlePanel=middlePanel;
        initComponents();
        this.setTitle(title);
        //set frame nicely in screen
        Toolkit tk = Toolkit.getDefaultToolkit ();
        Dimension d = tk.getScreenSize();
        int heightScreen = d.height / 2;
        int widthScreen = d.width / 2;   
        setLocation(widthScreen - (getWidth()/2), heightScreen - (getHeight()/2));
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        btnPanel = new javax.swing.JPanel();
        btnDone = new BJJButton();
        lblTitle = new javax.swing.JLabel(title);
        middlePanelToSet = new javax.swing.JPanel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        btnDone.setText("Done");
        btnDone.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnDoneActionPerformed(evt);
            }
        });
        btnPanel.add(btnDone);

        getContentPane().add(btnPanel, java.awt.BorderLayout.SOUTH);

        lblTitle.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        getContentPane().add(lblTitle, java.awt.BorderLayout.NORTH);

        middlePanelToSet=middlePanel;
        getContentPane().add(middlePanelToSet, java.awt.BorderLayout.CENTER);

        pack();
    }// </editor-fold>//GEN-END:initComponents


    private void btnDoneActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDoneActionPerformed
        dispose();
    }//GEN-LAST:event_btnDoneActionPerformed

    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnDone;
    private javax.swing.JPanel btnPanel;
    private javax.swing.JLabel lblTitle;
    private javax.swing.JPanel middlePanelToSet;
    // End of variables declaration//GEN-END:variables
    
}
